<?php

namespace App\Models;

use Illuminate\Database\Eloquent\SoftDeletes;

class Chat extends Base
{
    /**
     * 禁止被批量赋值的字段
     *
     * @var array
     */
    protected $guarded = [];

    // 软删除
    use SoftDeletes;

    public function storeData($data){

        //根据是否有id判断修改还是添加
        if(isset($data['id'])&&$data['id']){
            $this->where('id',$data['id'])->update($data);
        }else{
            $this->create($data);
        }
    }
}
